Skip to content

fix: correct audioPlayerState spreading in migration 18#3091

Open
haroon0x wants to merge 1 commit intoquran:productionfrom
haroon0x:fix/redux-migration-18
Open

fix: correct audioPlayerState spreading in migration 18#3091
haroon0x wants to merge 1 commit intoquran:productionfrom
haroon0x:fix/redux-migration-18

Conversation

@haroon0x
Copy link

@haroon0x haroon0x commented Feb 12, 2026

Summary

Migration 18 in src/redux/migrations.ts contains a copy-paste bug. It spreads state.readingPreferences into audioPlayerState, which completely overwrites the audio player state with unrelated reading preferences data.

Closes: #3088

Current Behavior

// src/redux/migrations.ts:121-127
18: (state) => ({
  ...state,
  audioPlayerState: {
    ...state.readingPreferences, // ❌ BUG: should be state.audioPlayerState
    showTooltipWhenPlayingAudio: false,
  },
}),

Changed

18: (state) => ({
  ...state,
  audioPlayerState: {
    ...state.audioPlayerState, // ✅ Correct
    showTooltipWhenPlayingAudio: false,
  },
}),

Impact

Any user whose Redux state was migrated through version 18 will have a corrupted audioPlayerState, with all audio player settings overwritten by reading preferences data. This can cause broken audio playback, incorrect reciter selection, and unexpected UI state.

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as
    expected)
  • 📝 Documentation update
  • ♻️ Refactoring (no functional changes)

If Breaking Change

Scope Confirmation

  • This PR addresses one feature/fix only
  • If multiple changes were needed, they are split into separate PRs

Environment Variables

Variable Description Required
EXAMPLE_VAR Description here Yes/No

Rollback Safety

  • Can be safely reverted without data issues or migrations
  • Rollback requires special steps (describe below):

Test Plan

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed

Testing steps:

  1. Step one
  2. Step two

Edge Cases Verified

  • ⏳ Loading state handled
  • ❌ Error state handled
  • 📭 Empty state handled
  • 👤 Logged-in vs guest behavior (if applicable)

Pre-Review Checklist

Code Quality

  • I have performed a self-review of my code (file by file)
  • My code follows the project style guidelines
  • No any types used (or justified if unavoidable)
  • No unused code, imports, or dead code included
  • Complex logic has inline comments explaining "why"
  • Functions are under 30 lines and follow single responsibility

Testing & Validation

  • All tests pass locally (yarn test)
  • Linting passes (yarn lint)
  • Build succeeds (yarn build)
  • Edge cases and error scenarios are handled

Documentation

  • Code is self-documenting with clear naming
  • README updated (if adding features or setup changes)
  • Inline comments added for complex logic

Localization (if UI changes)

  • All user-facing text uses next-translate
  • Only English locale files modified (Lokalise handles others)
  • RTL layout verified

Accessibility (if UI changes)

  • Semantic HTML elements used
  • ARIA attributes added where needed
  • Keyboard navigation works

Screenshots/Videos

Before After

Related PRs

Reviewer Notes

AI Assistance Disclosure

  • AI tools were NOT used for this PR
  • AI tools were used, and I have thoroughly reviewed and validated all generated code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug]: Bug in Redux Migrations

1 participant